<?php

namespace App\Models\cms;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * Class ContentPicture
 * @package App\Models
 */
class ContentPicture extends Model
{
    use SoftDeletes;
    /**
     * 对应表名
     * @var string
     */
    public $table = 'cms_content_picture';

    public $timestamps = false;

    /**
     * @var array
     */
    public $fillable = [
        'assets_id',
        'content_id',
        'point_url',
        'point_type',
        'point_category_id',
        'point_content_id',
        'assets_path',
        'description'
    ];

    public function contents()
    {
        return $this->morphOne('App\Models\Cms\Content', 'content_detail');
    }

    public function content()
    {
        return $this->hasOne(Content::class, 'id', 'content_id');
    }

    public function assets()
    {
        return $this->hasOne(Assets::class, 'id', 'assets_id');
    }

    public function category()
    {
        return $this->hasOne(Category::class, 'id', 'point_category_id');
    }
}
